package com.leige.store.service.Impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSON;
import com.leige.datasource.annotation.DataSourceChange;
import com.leige.store.model.Product;
import com.leige.store.repo.mapper.ProductMapper;
import com.leige.store.service.ProductService;
import com.leige.utils.Transfer;

@Service
public class ProductServiceImpl implements ProductService {
	
	@Autowired
	ProductMapper productMapper;
	
	@Override
	public long addAll(List<Product> recordList) {
		// TODO Auto-generated method stub
		return productMapper.insertList(null);
	}

	@DataSourceChange()
	@Override
	public List<Product> findAll() {
		// TODO Auto-generated method stub
		List<Product> list = productMapper.selectAll();
		list=Transfer.formArray(list, Product.class);
		
		return list;
	}

}
